import Vue from 'vue'
import VueRouter from 'vue-router'
// 登录组件
import Login from '@/views/Login.vue'
// 注册组件
import Reg from '@/views/Reg.vue'
// Layout架子组件
import Layout from '@/views/Layout/index.vue'
import Home from '@/views/Layout/Home'
import ArtCategory from '@/views/Layout/ArtCategory'
import ArtList from '@/views/Layout/ArtList'
import ChangeAvatar from '@/views/Layout/ChangeAvatar'
import UserInfo from '@/views/Layout/UserInfo'
import ResetPwd from '@/views/Layout/ResetPwd'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/login', component: Login },
    { path: '/reg', component: Reg },
    {
      path: '/',
      redirect: '/home',
      component: Layout,
      children: [
        { path: '/home', component: Home },
        { path: '/artcategory', component: ArtCategory },
        { path: '/artlist', component: ArtList },
        { path: '/userinfo', component: UserInfo },
        { path: '/changeavatar', component: ChangeAvatar },
        { path: '/resetpwd', component: ResetPwd }
      ]
    }
  ]
})

export default router
